 <template>
  <div slot="book">
    <a-card
                  :title="book.title"
                  :isbn="book.isbn"
                  :marcid="book.bookid"
                  :headStyle="headStyles"
                  style="width: 100%"
                >
                  <a-row
                    :gutter="16"
                    type="flex"
                    justify="space-around"
                    align="middle"
                  >
                    <a-col
                      :xs="23"
                      :sm="23"
                      :md="8"
                      :lg="6"
                      :xl="4"
                      @click="godetail(book.id, book.title)"
                    >
                      <img
                        align="center"
                        :src="book.cover"
                        width="100%"
                        style="margin: 0 auto; display: block"
                      />
                    </a-col>
                    <a-col :xs="1" :sm="1" :md="1" :lg="1" :xl="1"> </a-col>

                    <a-col :xs="24" :sm="24" :md="13" :lg="15" :xl="19">
                      <a-row>
                        <blockquote>
                          <p
                            class="list-group-item-text text-muted"
                            name="author"
                          >
                            作者:{{
                              book.author
                            }}&nbsp;&nbsp;/&nbsp;&nbsp;出版日期:{{
                              book.publish_date
                            }}&nbsp;&nbsp;/&nbsp;&nbsp;提供商:{{ book.src }}
                          </p>
                          <p
                            class="list-group-item-text text-muted"
                            name="isbn"
                            :value="book.isbn"
                          >
                            ISBN:{{
                              book.bisbn
                            }}&nbsp;&nbsp;/&nbsp;&nbsp;分类:{{
                              book.cates
                            }}&nbsp;&nbsp;/&nbsp;&nbsp;格式:{{ book.filetype }}
                          </p>
                        </blockquote>
                      </a-row>
                      <a-row data-id="intro">
                        <p class="list-group-item-text ">{{ book.intro }}</p>
                      </a-row>
                      <a-row>
                        <a-divider dashed />
                      </a-row>
                      <a-row>
                        <a-col
                          :xs="24"
                          :sm="24"
                          :md="13"
                          :lg="24"
                          style="display: flex"
                        >
                          <a
                            :href="book.read"
                            target="_blank"
                            class="btn-successread"
                            >电子书点此阅读</a
                          >
                          <div v-show="book.ebooklist !='' && book.ebooklist != undefined" style="display: contents">
                            <a
                             @click="EmitGetBookInfo(book.ebooklist.marcRecNo, book.ebooklist.title)"
                              target="_blank"
                              class="btn-successread"
                              style="margin: 0 5px"
                              >本馆纸书</a
                            >
                          </div>
                        </a-col>
                      </a-row>
                    </a-col>
                  </a-row>
                </a-card>
  </div>
</template>

<script>
// import axios from "axios";
// import VueAxios from "vue-axios";
export default {
  props: {
    book: Object,
    id: Number,
    title: String,
    author: String,
    publisher: String,
    publish_date: String,
    pub_year: Number,
    cover: String,
    intro: String,
    isbn: String,
    bisbn: String,
    category: String,
    cates: String,
    booktype: String,
    filetype: String,
    bookid: String,
    assertId: String,
    src: String,
    view_count: Number,
    extid: String,
    ext: String,
    created_at: Number,
    updated_at: Number,
    pc_read: String,
    pc_epub: String,
    wx_read: String,
    wx_epub: String,
    read:String,
    detail: String,
    content:String,
    ebooklist:Array
  },
  data: () => ({
    is_bookinfo_visible: false,
    is_spinning: false,
    header: {},
    body: {},
    info: [],
    headStyles:{
      color:'#2780e3',
      background:'#f5f5f5'
    },
    customStyle:
        'color:#2780e3',
  }),
  watch: {
  },
  computed:{
    getclassname() {
      return this.$store.state.Namedparent.name;
    },
  },
  methods: {
    // gopagerbook(e){
    //   let routeUrl =this.$router.resolve({
    //      path:'/PaperbookSearch',
    //     query:{
    //       searchtitle: e,
    //     }
    //   })
    //   window.open(routeUrl.href, '_blank');
    // },
    godetail(id,title){
      // this.$store.commit(this.$store.state.Namedparent.name+'/SHOW_DETAIL',true)
      var paras = {
            id:id,
            searchtitle:title,
            type:this.$store.state.Namedparent.name
      }
       this.$store.commit(this.$store.state.Namedparent.name+'/ChangeDetailQuery',paras)
        this.$router.push({
          path: '/EBookDetail', //QikanrBookDetail
          query: { 
            searchtitle:title,
            id:id
         },
      });
    },
    showDrawer() {
      this.is_bookinfo_visible = true;
      this.$emit("showbookid", true, this.bookid, this.title);
      this.$store.commit("ebook/BOOKINFO_ALREADY_SHOW", true);
    },
    onDrawerClose() {
      this.is_bookinfo_visible = false;
      this.$emit("showbookid", false);
      this.$store.commit("ebook/BOOKINFO_ALREADY_SHOW", false);
    },
    EmitGetBookInfo(marc_no, title) {
      this.$emit("showbookid", false, marc_no, title);
      this.$store.commit("ebook/BOOKINFO_ALREADY_SHOW", false);
    },
  },
  mounted() {
    if(this.$route.name == 'detail'){
      this.$store.commit(this.$store.state.Namedparent.name+'/SHOW_DETAIL',true)
    }else{
      this.$store.commit(this.$store.state.Namedparent.name+'/SHOW_DETAIL',false)
    }
    // this.$store.commit(this.$store.state.Namedparent.name+'/SHOW_DETAIL',true)
     
    // console.log(this.muluText)
   // var marc_no = this.$route.params.id;

   // console.log(" %c htis marc_no: ", "color:brown;", marc_no);
    // if (marc_no == this.bookid) {
    // if (!this.is_bookinfo_visible) {
    // this.is_bookinfo_visible = true;
    // this.GetBookInfo(marc_no);
    // this.$emit("ShowBookid", marc_no);
    // }
    // }
  },
};
</script>

<style scoped>
  /deep/.ant-collapse-header{
    color: blueviolet !important;
  }
  .text-muted{
    font-size: 15px;
  }
  .text-muted p{
    border-bottom: 1px dashed #EFEFEF;
    line-height: 2;
  }
  .text-muteds{
    text-align: center;
    margin: 5px auto;
  }
   .text-muteds p{
    margin: 0;
    height: 20px;
    line-height: 20px;
    overflow: hidden;
  }
.btn-success {
    color: #ffffff;
    background-color: #3fb618;
    border-color: #3fb618;
    text-align: center;
    border: 1px solid transparent;
    padding: 10px 10px;
    font-size: 15px;
}
.btn-successread{
    
    display: inline;
    color: #ffffff;
    background-color: #3fb618;
    border-color: #3fb618;
    text-align: center;
    border: 1px solid transparent;
    padding: 10px 10px;
    font-size: 15px;
}
.btn-successread:hover{
  background: #25690f;
}
.bookurl{
  width: 100%;
    display: block;
    height: 50px;
    position: absolute;
    top: 0;
    left: 0;
}
blockquote{
  padding: 10.5px 21px;
    margin: 0 0 21px;
    font-size: 18.75px;
    border-left: 5px solid #e6e6e6;
}
.list-group-item-text {
    margin-bottom: 0;
    line-height: 1.6;
}
.text-muted {
    color: #999999;
}

</style>
